<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var number = Math.floor(Math.random()*100)
    console.log(number);
    
    for (let i = 0; i < 7; i++) {
      
      var a = Number(prompt("请输入一个数字"))
      if (a<number) {
        alert("小了")
      }else if (a>number) {
        alert("大了")
      }else{
        alert("恭喜你猜中了")
        break
      }
    }
    

    
  </script>
</body>
</html>